#include <opencv2\opencv.hpp>
#include <cuda_runtime.h>


class LabelEquivalenceSeg{
public:
		typedef struct n_label{
			float4 normal;
			int label;
		};

        LabelEquivalenceSeg(int width, int height);
        ~LabelEquivalenceSeg();

        void labelImage(float4* in);
        void viewSegmentResult();
        void copyData(bool* boundary, int* label);

        int* getLabelMap() const;
        bool* getBoundaryMap() const;


private:
        void initialize(float4* in);
        void scan();
        void analysis();
        void postProcess();
                        

        int width;
        int height;
        n_label* img;
        int* label;
        int* ref;
        int* counter;

        
        bool* boundary_device;
        bool* boundary_host;

        cv::Mat_<cv::Vec3b> show;
        unsigned char** color_pool;
};